﻿using System.IO;
using System.ServiceModel;

namespace VMukti.Bussiness.WCFServices.BootStrapServices.BasicHttp
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class HttpPresentationUploadDelegates : IHttpPresentationUploadService
    {
        public delegate void DelsvcHttpJoin();
        public delegate void DelsvcHttpSendUploadedFile(string strFileName, byte[] bytearr, int intSig);
        public delegate string[] DelsvcHttpGetPresentationName();
        public delegate int DelsvcHttpSlidesCount(string PName);
        public delegate Stream DelsvcHttpGetSlideStream(byte[] pnameCnt);
        public delegate bool DelsvcHttpPPTExists(string filename);
        public delegate void DelsvcHttpUnJoin();


        public event DelsvcHttpJoin EntsvcHttpJoin;
        public event DelsvcHttpSendUploadedFile EntsvcHttpSendUploadedFile;
        public event DelsvcHttpGetPresentationName EntsvcHttpGetPresentationName;
        public event DelsvcHttpSlidesCount EntsvcHttpSlidesCount;
        public event DelsvcHttpGetSlideStream EntsvcHttpGetSlideStream;
        public event DelsvcHttpPPTExists EntsvcHttpPPTExists;
        public event DelsvcHttpUnJoin EntsvcHttpUnJoin;

        public void svcHttpJoin()
        {
            if (EntsvcHttpJoin != null)
            {
                EntsvcHttpJoin();
            }
        }

        public void svcHttpSendUploadedFile(string strFileName, byte[] bytearr, int intSig)
        {
            if (EntsvcHttpSendUploadedFile != null)
            {
                EntsvcHttpSendUploadedFile(strFileName, bytearr, intSig);
            }
        }

        public string[] svcHttpGetPresentationName()
        {
            if (EntsvcHttpGetPresentationName != null)
            {
                return EntsvcHttpGetPresentationName();
            }
            else
            {
                return null;
            }
        }

        public int svcHttpSlidesCount(string PName)
        {
            if (EntsvcHttpSlidesCount != null)
            {
                return EntsvcHttpSlidesCount(PName);
            }
            else
            {
                return -1;
            }
        }

        public Stream svcHttpGetSlideStream(byte[] pnameCnt)
        {
            if (EntsvcHttpGetSlideStream != null)
            {
                return EntsvcHttpGetSlideStream(pnameCnt);
            }
            else
            {
                return null;
            }
        }

        public bool svcHttpPPTExists(string filename)
        {
            if (EntsvcHttpPPTExists != null)
            {
                return EntsvcHttpPPTExists(filename);
            }
            else
            {
                return false;
            }
        }

        public void svcHttpUnJoin()
        {
            if (EntsvcHttpUnJoin != null)
            {
                EntsvcHttpUnJoin();
            }
        }

    }
}
